package tech.runchen.gz5055.oms.common.utils.file;

import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author zzj
 */
public class FileUtils {

    /**
     * 获取MD5
     *
     * @param file 上传文件对象
     * @return 文件MD5值
     */
    public static String getMd5(MultipartFile file) {
        try {
            byte[] uploadBytes = file.getBytes();
            return DigestUtils.md5Hex(uploadBytes);
        } catch (Exception e) {
            e.getMessage();
        }
        return null;
    }
}
